package cn.ly.core.annotation;

import java.lang.reflect.*;

public class TestAnnotion {
	
	public static void main(String[] args) throws ClassNotFoundException{
		
		String CLASS_NAME = "cn.ly.core.annotation.JavaEye";
		Class test = Class.forName(CLASS_NAME);
		
		Field[] f = test.getDeclaredFields();
		System.out.println(f.length);
		for(Field fi : f){
			System.out.println(fi.getName());
		}
		

		Method[] method = test.getMethods();
		boolean flag = test.isAnnotationPresent(Description.class);
		if(flag){
			Description des = (Description)test.getAnnotation(Description.class);
			test.getAnnotations();
			System.out.println("value:" + des.value());
			System.out.println("==========================");
		}
		
		
		for(int i = 0; i < method.length; i++){
			Class[] params = method[i].getParameterTypes();
			for(Class c : params){
				System.out.println(c.getName());
			}
			boolean flag2 = method[i].isAnnotationPresent(Name.class);
			Name name = null;
			if(flag2){
				name = method[i].getAnnotation(Name.class);
				System.out.println(name.originate());
				System.out.println("name:"+name.community());
			}
		}
	}

}
